﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Views.BandedGrid;

namespace CCT
{
    public static class MyStyle
    {
        public static Color ROW_BACKCOLOR = Color.FromArgb(254, 230, 140);
        public static Color DELETE_COLOR = Color.FromArgb(81, 181, 255);
        public static Font DELETE_FONT = new Font("Tahoma", 8.25F, FontStyle.Strikeout);

        public static void SetGridStyle(GridView grv, bool edit)
        {
            grv.Appearance.FocusedCell.BackColor = (edit ? Color.FromArgb(254, 230, 140) : Color.FromArgb(255, 239, 181));
            grv.Appearance.FocusedCell.ForeColor = Color.Black;

            Color backColor = (edit ? Color.White : ROW_BACKCOLOR);
            Color foreColor = Color.Black;

            grv.Appearance.FocusedRow.BackColor = backColor;
            grv.Appearance.FocusedRow.ForeColor = foreColor;

            grv.Appearance.HideSelectionRow.BackColor = backColor;
            grv.Appearance.HideSelectionRow.ForeColor = foreColor;

            grv.Appearance.SelectedRow.BackColor = backColor;
            grv.Appearance.SelectedRow.ForeColor = foreColor;
        }

        public static void SetGridStyle(BandedGridView grv, bool edit)
        {
            grv.Appearance.FocusedCell.BackColor = (edit ? Color.FromArgb(254, 230, 140) : Color.FromArgb(255, 239, 181));
            grv.Appearance.FocusedCell.ForeColor = Color.Black;

            Color backColor = (edit ? Color.White : ROW_BACKCOLOR);
            Color foreColor = Color.Black;

            grv.Appearance.FocusedRow.BackColor = backColor;
            grv.Appearance.FocusedRow.ForeColor = foreColor;

            grv.Appearance.HideSelectionRow.BackColor = backColor;
            grv.Appearance.HideSelectionRow.ForeColor = foreColor;

            grv.Appearance.SelectedRow.BackColor = backColor;
            grv.Appearance.SelectedRow.ForeColor = foreColor;
        }
    }
}
